<?php
$params = array_merge ( require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php' );

return [ 
		'language' => 'zh-CN',
		'id' => 'app-backend',
		'basePath' => dirname ( __DIR__ ),
		'controllerNamespace' => 'backend\controllers',
		'bootstrap' => [ 
				'log' 
		],
		'modules' => [
				"admin" => [ 
						"class" => "mdm\admin\Module" 
				] 
		],
		"aliases" => [ 
				"@mdm/admin" => "@vendor/mdmsoft/yii2-admin" 
		],
		'as access' => [
				'class' => 'mdm\admin\components\AccessControl',
				'allowActions' => [
						// 这里是允许访问的action
						// controller/action
						// * 表示允许所有，后期会介绍这个
						'*' 
				]
				// 'site/*',//允许访问的节点，可自行添加
				// 'admin/*',//允许所有人访问admin节点及其子节点
				 
		],
		'components' => [ 
				'request' => [ 
						'csrfParam' => '_csrf-backend' 
				],
				'user' => [ 
						'identityClass' => 'common\models\User',
						'enableAutoLogin' => true,
						'identityCookie' => [ 
								'name' => '_identity-backend',
								'httpOnly' => false,
                                'domain'=>'.domain.cc',
                                'path'=>'/',

						] 
				],
				'session' => [
						// this is the name of the session cookie used for login on the backend
						'name' => 'advanced-backend' 
				],
				'log' => [ 
						'traceLevel' => YII_DEBUG ? 1 : 0,
						'targets' => [ 
								[ 
										'class' => 'yii\log\FileTarget',
										'levels' => [ 
												'error',
												'warning',
										        'trace',
										] 
								],
    						    // 以下是新加
//     						    [
    						        
//     						        'class'=>'yii\log\DbTarget',
//     						        'config'=>'alignLeft, opaque, runInDebug, fixedPos, collapsed, yamlStyle',
//     						        'levels'=>['error', 'warning', 'trace', 'profile', 'info'],
//     						        'categories' => 'system.db.*',
//     						        'allowedIPs'=>array('127.0.0.1','::1','192\.168\.1[0-5]\.[0-9]{3}','如果程序在外网需要填入你的公网的ip'),
//     						        'logFiles' => 'app_'.date('Y-m-d').'.log',//日志保存文件名
//     						        'logPath'=>'D:WWW/log_db',//日志保存路径
    						        
//     						    ] 
						],
// 				        'routes' => [
// 				            'class'=>'CFileLogRoute',//文件记录日志的形式
// 				            'levels'=>'trace',//日志记录级别
// 				            'categories'=>'system.db.*',//只显示关于数据库信息，包括数据库连接，数据库执行语句
// 				            'logFile' => 'app_'.date('Y-m-d').'.log',//日志保存文件名
// 				            'logPath'=>'D:WWW/log_db',//日志保存路径
// 				        ]
				],
				'errorHandler' => [ 
						'errorAction' => 'site/error' 
				],
				"authManager" => [ //权限管理为数据库模式
						"class" => 'yii\rbac\DbManager',
						"defaultRoles" => ["guest"],
				],
				'urlManager' => [ //网址美化
						'enablePrettyUrl' => true,
						'showScriptName' => false,
						'rules' => [ ] 
				],
    		    'assetManager' =>[//可以实现css修改后立即生效
                   'class' => 'yii\web\AssetManager',
                   'appendTimestamp' => true,
                   'forceCopy' => false,
                ],
		],
		'params' => $params 
];
